package com.smart.utils;


import lombok.extern.log4j.Log4j2;

/**
 * @author Xiaxuqiu
 * @date 2022-07-13
 **/

@Log4j2
public class MemberAcl {


    /**
     * 生成会员令牌标识
     *
     * @param loginId 登录id
     * @return {@code String}
     */
    public static String login(Long loginId) {
        MemberStp.login(loginId, 60 * 60 * 24 * 15);
        return MemberStp.getTokenInfo().getTokenValue();
    }


    /**
     * 得到获得会员的TokenId
     *
     * @return {@link Long}
     */
    public static Long getLoginId() {
        return MemberStp.getLoginIdAsLong();
    }

    /**
     * 注销登录
     */
    public static void loginOut(Long memberId) {
        MemberStp.logout(memberId);
    }


}
